package teach.aistar.service.impl;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import teach.aistar.mapper.EmailMapper;

import teach.aistar.model.entity.Email;
import teach.aistar.service.IEmailService;

import java.util.HashMap;
import java.util.Map;
@Service
@Transactional
public class EmailServiceImpl implements IEmailService {


    @Autowired
    private RabbitTemplate rabbitTemplate;
    @Autowired
    private RedisTemplate redisTemplate;

    @Autowired
    private EmailMapper emailMapper;
    @Override
    public void send(String email) {

//        Map<String,Object> dataMaps = new HashMap<>();
//
//        dataMaps.put("uName",uName);
//        dataMaps.put("secId",secId);
//        ValueOperations vop = redisTemplate.opsForValue();
//        vop.set("code",code);

        rabbitTemplate.convertAndSend("emailx","",email);



    }

    @Override
    public int insertE(Email email) {
        return emailMapper.insertE(email);
    }
}
